﻿// Decompiled with JetBrains decompiler
// Type: Bannerlord.BUTR.Shared.Utils.WrappedConstructorInfo
// Assembly: MCMv5, Version=5.10.2.0, Culture=neutral, PublicKeyToken=null
// MVID: 7AB326B9-B2B4-41C2-9177-68E944071101
// Assembly location: D:\steam\steamapps\workshop\content\261550\2859238197\bin\Win64_Shipping_Client\MCMv5.dll

using System;
using System.Globalization;
using System.Reflection;

#nullable enable
namespace Bannerlord.BUTR.Shared.Utils
{
  internal sealed class WrappedConstructorInfo : ConstructorInfo
  {
    private readonly object[] _args;
    private readonly ConstructorInfo _constructorInfoImplementation;

    public WrappedConstructorInfo(ConstructorInfo actualConstructorInfo, object[] args)
    {
      this._constructorInfoImplementation = actualConstructorInfo;
      this._args = args;
    }

    public override object[] GetCustomAttributes(bool inherit)
    {
      return this._constructorInfoImplementation.GetCustomAttributes(inherit);
    }

    public override bool IsDefined(Type attributeType, bool inherit)
    {
      return this._constructorInfoImplementation.IsDefined(attributeType, inherit);
    }

    public override ParameterInfo[] GetParameters()
    {
      return this._constructorInfoImplementation.GetParameters();
    }

    public override MethodImplAttributes GetMethodImplementationFlags()
    {
      return this._constructorInfoImplementation.GetMethodImplementationFlags();
    }

    public override object Invoke(
      object obj,
      BindingFlags invokeAttr,
      Binder binder,
      object[] parameters,
      CultureInfo culture)
    {
      return this._constructorInfoImplementation.Invoke(obj, invokeAttr, binder, parameters, culture);
    }

    public override string Name => this._constructorInfoImplementation.Name;

    public override Type? DeclaringType => this._constructorInfoImplementation.DeclaringType;

    public override Type? ReflectedType => this._constructorInfoImplementation.ReflectedType;

    public override RuntimeMethodHandle MethodHandle
    {
      get => this._constructorInfoImplementation.MethodHandle;
    }

    public override MethodAttributes Attributes => this._constructorInfoImplementation.Attributes;

    public override object[] GetCustomAttributes(Type attributeType, bool inherit)
    {
      return this._constructorInfoImplementation.GetCustomAttributes(attributeType, inherit);
    }

    public override object Invoke(
      BindingFlags invokeAttr,
      Binder binder,
      object[] parameters,
      CultureInfo culture)
    {
      return this._constructorInfoImplementation.Invoke(invokeAttr, binder, this._args, culture);
    }
  }
}
